package com.tao.drop;

import io.swagger.annotations.Api;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.bind.annotation.RequestMapping;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

/**
 * Created by tao on 2017/8/24.
 */
@Configuration
@EnableSwagger2
public class Swagger2Config {


    private ApiInfo apiInfo () {
        ApiInfo apiInfo = new ApiInfo("demo api info","demo","0.0.1","tao","LvShiTao","www.drop.com","Http://www.drop.com");
        return apiInfo;
    }

    @Bean
    public Docket swaggerSpringMvcPlugin() {
        return new Docket(DocumentationType.SWAGGER_2)
                .apiInfo(apiInfo())
                .select()
                //********************************指定包
                .apis(RequestHandlerSelectors.basePackage("com.tao.drop.controller"))
                .paths(PathSelectors.any()).build();
    }

}
